using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections.ObjectModel;

namespace SATF.BI
{
    public class BITasks : BaseCollection
    {

        public BITasks()
        { 
        }

        private List<BITask> m_children;
        public List<BITask> Children
        {
            get 
            { 
                if (m_children == null)
                {
                    m_children = new List<BITask>();
                }
                return m_children; 
            }
            set { m_children = value; }
        }

        public BITasks(DataTable table)
            : base(table)
        {

        }

        public override void Fill(System.Data.DataTable table)
        {
            foreach (DataRow row in table.Rows)
            {
               //this.Children.Add(new BIMyTask(row));
                this.Add(new BITask(row));
            }
        }

        public ObservableCollection<BITask> GetObservableCollection()
        {
            ObservableCollection<BITask> obCollection = new ObservableCollection<BITask>();
            foreach (BITask item in this)
            {
                obCollection.Add(item);
            }
            return obCollection;
        }

        public override void Update()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        public override void Refresh()
        {
            throw new Exception("The method or operation is not implemented.");
        }
    }
}
